import 'package:gold/generated/json/base/json_convert_content.dart';
import 'package:gold/model/point_statistics_model.dart';

PointStatisticsModel $PointStatisticsModelFromJson(Map<String, dynamic> json) {
  final PointStatisticsModel pointStatisticsModel = PointStatisticsModel();
  final int? remainingPoints = jsonConvert.convert<int>(json['remaining_points']);
  if (remainingPoints != null) {
    pointStatisticsModel.remainingPoints = remainingPoints;
  }
  final int? incomingPoints = jsonConvert.convert<int>(json['incoming_points']);
  if (incomingPoints != null) {
    pointStatisticsModel.incomingPoints = incomingPoints;
  }
  final int? totalPoints = jsonConvert.convert<int>(json['total_points']);
  if (totalPoints != null) {
    pointStatisticsModel.totalPoints = totalPoints;
  }
  final int? allocatedPoints = jsonConvert.convert<int>(json['allocated_points']);
  if (allocatedPoints != null) {
    pointStatisticsModel.allocatedPoints = allocatedPoints;
  }
  final int? pendingPoints = jsonConvert.convert<int>(json['pending_points']);
  if (pendingPoints != null) {
    pointStatisticsModel.pendingPoints = pendingPoints;
  }
  final int? totalGiftedPoints = jsonConvert.convert<int>(json['total_gifted_points']);
  if (totalGiftedPoints != null) {
    pointStatisticsModel.totalGiftedPoints = totalGiftedPoints;
  }
  final int? totalRedeemedPoints = jsonConvert.convert<int>(json['total_redeemed_points']);
  if (totalRedeemedPoints != null) {
    pointStatisticsModel.totalRedeemedPoints = totalRedeemedPoints;
  }
  return pointStatisticsModel;
}

Map<String, dynamic> $PointStatisticsModelToJson(PointStatisticsModel entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['remaining_points'] = entity.remainingPoints;
  data['incoming_points'] = entity.incomingPoints;
  data['total_points'] = entity.totalPoints;
  data['allocated_points'] = entity.allocatedPoints;
  data['pending_points'] = entity.pendingPoints;
  data['total_gifted_points'] = entity.totalGiftedPoints;
  data['total_redeemed_points'] = entity.totalRedeemedPoints;
  return data;
}

extension PointStatisticsModelExtension on PointStatisticsModel {
  PointStatisticsModel copyWith({
    int? remainingPoints,
    int? incomingPoints,
    int? totalPoints,
    int? allocatedPoints,
    int? pendingPoints,
    int? totalGiftedPoints,
    int? totalRedeemedPoints,
  }) {
    return PointStatisticsModel()
      ..remainingPoints = remainingPoints ?? this.remainingPoints
      ..incomingPoints = incomingPoints ?? this.incomingPoints
      ..totalPoints = totalPoints ?? this.totalPoints
      ..allocatedPoints = allocatedPoints ?? this.allocatedPoints
      ..pendingPoints = pendingPoints ?? this.pendingPoints
      ..totalGiftedPoints = totalGiftedPoints ?? this.totalGiftedPoints
      ..totalRedeemedPoints = totalRedeemedPoints ?? this.totalRedeemedPoints;
  }
}